/* 
    倒计时
  */
if ('addEventListener' in document) {
  document.addEventListener('DOMContentLoaded', function () {
    FastClick.attach(document.body);
  }, false);
}  
(function(){


  
  var times = 1800;
  setInterval(function(){
    if(times >= 1){
      times--;
    }
    formate(times)
  }, 1000)
  formate(times)
  function formate (t) {
    if(t >= 0 ){
      var
        s = t % 60,
        m = Math.floor(t / 60) % 60,
        h = Math.floor(t / 60 / 60);

      s = s < 10 ? '0' + s : s;
      m = m < 10 ? '0' + m : m;
      h = h < 10 ? '0' + h : h;

      var time = h + ":" + m + ":" + s
      $('.time time').text(time)
    }
    
  }

  $(window).on('scroll', function(){
    // console.log($(this).scrollTop())
    if($(this).scrollTop() > 545){
      $('.pay-btn').css('display', 'flex')
    }else{
      $('.pay-btn').hide()
    }
  })
  $('.payall').on('tap', function(e){
    e.preventDefault()
    $('.pay-masking').show()
  })

  $('.pay-mask').on('tap', function(e){
    e.stopPropagation()
  })
  $('.pay-masking').on('tap', function(e){
    var _this = this;
    setTimeout(function(){
      $(_this).hide()
    }, 300)
  })
  // $('.info-name').text(localStorage.getItem('name') + "(" + localStorage.getItem('sex') + ")")
  // var src = localStorage.getItem('sex') === "男" ? "male" : "female"
  // $('.maijia-info .img-round').attr('src', './img/temp/' + src + '.jpg')

  $('.btn-wx, .btn-alipay').on('tap', function(){
    loading.open()    
    setTimeout(() => {
      loading.close()
    }, 1300);
  })
}())
